/*************************************************************************
 * File Name:    C.cc
 * Author:       zero91
 * Mail:         jianzhang9102@gmail.com
 * Created Time: Thu 17 Oct 2013 06:47:39 PM CST
 * 
 * Description:  http://codeforces.com/contest/356/problem/C
 ************************************************************************/

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>

using namespace std;

int
main(int argc, char *argv[])
{
    int n, t, ans;
    int cnt[5];

    while (scanf("%d", &n) != EOF) {
        memset(cnt, 0, sizeof(cnt));
        for (int i = 0; i < n; ++i) {
            scanf("%d", &t);
            ++cnt[t];
        }
        if (num[1] == num[2]) {
            printf("%d\n", num[1]);
        } else if (num[1] < num[2]) {
            ans += num[1];
            num[3] += num[1];
            num[2] -= num[1];
            num[1] = 0;

            ans += num[2] / 3 * 2;
            num[3] += num[2] / 3 * 2;
            num[2] %= 3;

            if (num[2] <= num[4]) {
                printf("%d\n", ans + num[2]);
            } else if ((num[2] - num[4]) * 2 <= num[3] + num[4] * 2) {
                printf
            } else {
            }
        } else {
        }
    }
    return 0;
}
